package com.zhixing.order.config;

import com.alibaba.fastjson2.JSON;
import com.zhixing.common.constant.Constant;
import com.zhixing.common.utils.UserContext;
import feign.RequestInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FeignConfig {

    @Bean
    public RequestInterceptor requestInterceptor() {
        return requestTemplate -> requestTemplate
                .header(Constant.USER_INFO, JSON.toJSONString(UserContext.getUserInfo()));
    }
}
